import unittest

import app
from lib.HTMLTestRunner_PY3 import HTMLTestRunner
from script.test01_reg_login import TestRegLogin
from script.test02_open_account import TestOpenAccount
from script.test03_recharge import TestRecharge
from script.test04_tender import TestTender

# 实例化测试套件
suite = unittest.TestSuite()
# 添加测试类
suite.addTest(unittest.makeSuite(TestRegLogin))
suite.addTest(unittest.makeSuite(TestOpenAccount))
suite.addTest(unittest.makeSuite(TestRecharge))
suite.addTest(unittest.makeSuite(TestTender))

# 生成测试报告存放的位置和名称
report_path = app.BASE_DIR + "/report/" + "report.html"

# 将测试结果写入到测试报告中
with open(report_path, mode="wb") as f:
    # 实例化HTMLTestRunner类
    runner = HTMLTestRunner(f)
    # 运行测试套件
    runner.run(suite)
